<?php

namespace App\Http\Controllers\Api;

use App\Http\Controllers\BaseController;
use Illuminate\Http\Request;

/**
 * @package App\Http\Controllers\Api
 * @see NoteController
 */
class NoteController extends BaseController
{

    /**
     * add
     * @uri /note/add
     * @param Request $request
     * @return \Illuminate\Http\JsonResponse
     * @request {"article_id":"34799AC564657D74","content":"BCD171A97955A9CC","is_public":"C280125F841B1852"}
     * @response {"success":true,"statusCode":200,"result":{"id":"24\u4f4d\u7b14\u8bb0ID"},"message":"OK"}
     */
    public function add(Request $request)
    {
        $params = $request->all();

        // @todo api data from mock.
        $mock = json_decode(
            mb_convert_encoding(
                '{"success":true,"statusCode":200,"result":{"id":"24\u4f4d\u7b14\u8bb0ID"},"message":"OK"}'
                , 'UTF-8', 'UTF-8,GBK,GB2312,BIG5' )
            , true
        );
        $data = $mock['result'];

        return $this->apiReturn($data);
    }

    /**
     * addLine
     * @uri /note/add-line
     * @param Request $request
     * @return \Illuminate\Http\JsonResponse
     * @request {"article_id":"542B068C4A70D3F7","content":"479112326A4F5F57","selected":"F7807CE169CA2644","start_index":"445AC2C43DA61956","end_index":"7BCE776B9C7C324C","is_public":"EF2CCEDD5EE681DA"}
     * @response {"success":true,"statusCode":200,"result":{"id":"24\u4f4d\u7b14\u8bb0ID","start_index":3,"end_index":5},"message":"OK"}
     */
    public function addLine(Request $request)
    {
        $params = $request->all();

        // @todo api data from mock.
        $mock = json_decode(
            mb_convert_encoding(
                '{"success":true,"statusCode":200,"result":{"id":"24\u4f4d\u7b14\u8bb0ID","start_index":3,"end_index":5},"message":"OK"}'
                , 'UTF-8', 'UTF-8,GBK,GB2312,BIG5' )
            , true
        );
        $data = $mock['result'];

        return $this->apiReturn($data);
    }

    /**
     * articleList
     * @uri /note/article-list
     * @param Request $request
     * @return \Illuminate\Http\JsonResponse
     * @request {"article_id":"71E4AE8DC2B8C8F8","tab":"A3CB99EA82E86BF6","order":"0FE18CBC3EA2BC20","last_id":"771A5FF744F71DE3"}
     * @response {"success":true,"statusCode":200,"result":{"have_more":40,"list":[{"id":"24\u4f4d\u6587\u7ae0ID","content":"\u7b14\u8bb0\u5185\u5bb9","selected":"\u6587\u7ae0\u8282\u9009","start_index":3,"end_index":5,"is_fail":0,"is_public":2,"is_collect":false,"is_like":false,"created_at":1592910533,"user":{"id":"24\u4f4d\u7528\u6237ID","nickname":"\u7528\u6237\u6635\u79f0","avatar":"\u5934\u50cf","attention_status":"\u5173\u6ce8\u72b6\u6001\uff0c1\u6ca1\u5173\u6ce8\uff0c2\u5173\u6ce8\u4e86\uff0c3\u81ea\u5df1\uff0c4\u4e92\u5173"},"count":{"collect":1,"like":0,"comment":0},"article":{"id":"24\u4f4d\u6587\u7ae0ID","title":"\u6587\u7ae0\u6807\u9898","cover_url":"\u5c01\u9762\u56fe","description":"\u6587\u7ae0\u6458\u8981"}}]},"message":"OK"}
     */
    public function articleList(Request $request)
    {
        $params = $request->all();

        // @todo api data from mock.
        $mock = json_decode(
            mb_convert_encoding(
                '{"success":true,"statusCode":200,"result":{"have_more":40,"list":[{"id":"24\u4f4d\u6587\u7ae0ID","content":"\u7b14\u8bb0\u5185\u5bb9","selected":"\u6587\u7ae0\u8282\u9009","start_index":3,"end_index":5,"is_fail":0,"is_public":2,"is_collect":false,"is_like":false,"created_at":1592910533,"user":{"id":"24\u4f4d\u7528\u6237ID","nickname":"\u7528\u6237\u6635\u79f0","avatar":"\u5934\u50cf","attention_status":"\u5173\u6ce8\u72b6\u6001\uff0c1\u6ca1\u5173\u6ce8\uff0c2\u5173\u6ce8\u4e86\uff0c3\u81ea\u5df1\uff0c4\u4e92\u5173"},"count":{"collect":1,"like":0,"comment":0},"article":{"id":"24\u4f4d\u6587\u7ae0ID","title":"\u6587\u7ae0\u6807\u9898","cover_url":"\u5c01\u9762\u56fe","description":"\u6587\u7ae0\u6458\u8981"}}]},"message":"OK"}'
                , 'UTF-8', 'UTF-8,GBK,GB2312,BIG5' )
            , true
        );
        $data = $mock['result'];

        return $this->apiReturn($data);
    }

    /**
     * del
     * @uri /note/del
     * @param Request $request
     * @return \Illuminate\Http\JsonResponse
     * @request {"id":"B410E5FF50A7B4A4"}
     * @response {"success":true,"statusCode":200,"result":true,"message":"OK"}
     */
    public function del(Request $request)
    {
        $params = $request->all();

        // @todo api data from mock.
        $mock = json_decode(
            mb_convert_encoding(
                '{"success":true,"statusCode":200,"result":true,"message":"OK"}'
                , 'UTF-8', 'UTF-8,GBK,GB2312,BIG5' )
            , true
        );
        $data = $mock['result'];

        return $this->apiReturn($data);
    }

    /**
     * edit
     * @uri /note/edit
     * @param Request $request
     * @return \Illuminate\Http\JsonResponse
     * @request {"id":"AAFBA5BC0B9E41E1","is_public":"F16BB3648F71D8CF"}
     * @response {"success":true,"statusCode":200,"result":true,"message":"OK"}
     */
    public function edit(Request $request)
    {
        $params = $request->all();

        // @todo api data from mock.
        $mock = json_decode(
            mb_convert_encoding(
                '{"success":true,"statusCode":200,"result":true,"message":"OK"}'
                , 'UTF-8', 'UTF-8,GBK,GB2312,BIG5' )
            , true
        );
        $data = $mock['result'];

        return $this->apiReturn($data);
    }

    /**
     * getDetail
     * @uri /note/get-detail
     * @param Request $request
     * @return \Illuminate\Http\JsonResponse
     * @request {"id":"2528587434B0BAF6"}
     * @response {"success":true,"statusCode":200,"result":{"id":"00KI11C79HFZO4XLP9JK8O82","user_id":"00K5H1KO60NAEIXXDT1SPMMM","article_id":"00KI01SU497ZFJWUVUULMX53","is_choice":0,"is_deleted":0,"is_public":1,"is_shield":0,"created_at":1606528079,"content":"123","selected":"\u6587\u7ae0\u8282\u9009","user":{"id":"00K5H1KO60NAEIXXDT1SPMMM","nickname":"\u7c89\u5237\u5320","avatar":"2e40f4e2d75d6db4e2deba6dc58f1105.png"},"article":{"id":"00KI01SU497ZFJWUVUULMX53","cover_url":"","title":"\u6587\u7ae0\u6807\u9898","description":"\u6587\u7ae0\u63cf\u8ff0","is_deleted":0,"is_shield":0,"created_at":1606468389},"count":{"collect":0,"like":0,"comment":0},"is_like":0,"is_collect":0},"message":"OK"}
     */
    public function getDetail(Request $request)
    {
        $params = $request->all();

        // @todo api data from mock.
        $mock = json_decode(
            mb_convert_encoding(
                '{"success":true,"statusCode":200,"result":{"id":"00KI11C79HFZO4XLP9JK8O82","user_id":"00K5H1KO60NAEIXXDT1SPMMM","article_id":"00KI01SU497ZFJWUVUULMX53","is_choice":0,"is_deleted":0,"is_public":1,"is_shield":0,"created_at":1606528079,"content":"123","selected":"\u6587\u7ae0\u8282\u9009","user":{"id":"00K5H1KO60NAEIXXDT1SPMMM","nickname":"\u7c89\u5237\u5320","avatar":"2e40f4e2d75d6db4e2deba6dc58f1105.png"},"article":{"id":"00KI01SU497ZFJWUVUULMX53","cover_url":"","title":"\u6587\u7ae0\u6807\u9898","description":"\u6587\u7ae0\u63cf\u8ff0","is_deleted":0,"is_shield":0,"created_at":1606468389},"count":{"collect":0,"like":0,"comment":0},"is_like":0,"is_collect":0},"message":"OK"}'
                , 'UTF-8', 'UTF-8,GBK,GB2312,BIG5' )
            , true
        );
        $data = $mock['result'];

        return $this->apiReturn($data);
    }

    /**
     * lineList
     * @uri /note/line-list
     * @param Request $request
     * @return \Illuminate\Http\JsonResponse
     * @request {"start_index":"F1C8ECE8893DB6ED","end_index":"ABA9909D55817313","order":"F41FBF476953F3F5","last_id":"4BAF8346D32C7F5A"}
     * @response {"success":true,"statusCode":200,"result":{"have_more":false,"list":[{"id":"00KI11C79HFZO4XLP9JK8O82","user_id":"00K5H1KO60NAEIXXDT1SPMMM","article_id":"00KI01SU497ZFJWUVUULMX53","is_choice":0,"is_deleted":0,"is_public":1,"is_shield":0,"created_at":1606528079,"start_index":2427,"end_index":2501,"content":"123","selected":"\u6587\u7ae0\u8282\u9009","is_like":false,"is_collect":false,"user":{"id":"00K5H1KO60NAEIXXDT1SPMMM","nickname":"\u7c89\u5237\u5320","avatar":"2e40f4e2d75d6db4e2deba6dc58f1105.png"},"article":{"id":"00KI01SU497ZFJWUVUULMX53","cover_url":"","title":"\u6587\u7ae0\u6807\u9898","description":"\u6587\u7ae0\u63cf\u8ff0","is_deleted":0,"is_shield":0,"created_at":1606468389},"count":{"comment":0,"like":0,"collect":0}}]},"message":"OK"}
     */
    public function lineList(Request $request)
    {
        $params = $request->all();

        // @todo api data from mock.
        $mock = json_decode(
            mb_convert_encoding(
                '{"success":true,"statusCode":200,"result":{"have_more":false,"list":[{"id":"00KI11C79HFZO4XLP9JK8O82","user_id":"00K5H1KO60NAEIXXDT1SPMMM","article_id":"00KI01SU497ZFJWUVUULMX53","is_choice":0,"is_deleted":0,"is_public":1,"is_shield":0,"created_at":1606528079,"start_index":2427,"end_index":2501,"content":"123","selected":"\u6587\u7ae0\u8282\u9009","is_like":false,"is_collect":false,"user":{"id":"00K5H1KO60NAEIXXDT1SPMMM","nickname":"\u7c89\u5237\u5320","avatar":"2e40f4e2d75d6db4e2deba6dc58f1105.png"},"article":{"id":"00KI01SU497ZFJWUVUULMX53","cover_url":"","title":"\u6587\u7ae0\u6807\u9898","description":"\u6587\u7ae0\u63cf\u8ff0","is_deleted":0,"is_shield":0,"created_at":1606468389},"count":{"comment":0,"like":0,"collect":0}}]},"message":"OK"}'
                , 'UTF-8', 'UTF-8,GBK,GB2312,BIG5' )
            , true
        );
        $data = $mock['result'];

        return $this->apiReturn($data);
    }

}